import { reqGetBannerList } from '@/api'

const state = {
  bannerList: {}
}

const mutations = {
  GETBANNERLIST(state, bannerList) {
    state.bannerList = bannerList
  }
}

const actions = {
  async getBannerList({ commit }) {
    // eslint-disable-next-line prefer-const
    let result = await reqGetBannerList()
    console.log(result)
    if (result.code === 200) {
      commit('GETBANNERLIST', result.data)
    }
  }
}

const getters = {
  weekendList(state) {
    return state.bannerList.weekendList || []
  },
  recommendList(state) {
    return state.bannerList.recommendList || []
  },
  swiperList(state) {
    return state.bannerList.swiperList || []
  },
  iconList(state) {
    return state.bannerList.iconList || []
  }
}
export default {
  state,
  mutations,
  actions,
  getters
}
